Labraries yang digunakan untuk Spasial autokorelasi
library(spdep)
library(maptools)
library(DT)
library(sf)
library(ggplot2)
library(leaflet)
library(tmap)
library("sp")
library("rgdal")
library("rgeos")
options(scipen = 999)
Anselin (1998) mengenalkan Exploratory Spatial Data Analysis (ESDA) dengan menggunakan autokorelasi spasial (spatial autocorrelation), yaitu suatu analisis yang dapat digunakan untuk mengetahui pola spasial (spatial pattern) dan asosiasi spasial (spatial association).
Anselin, dkk (2000) menyatakan bahwa autokorelasi spasial (spatial autocorrelation) dapat digunakan untuk mengetahui korelasi ruang atau wilayah pada suatu variabel dengan ruang atau wilayah lain.
Salah satu metode statistik dalam pengujian autokorelasi spasial adalah Moran’s I dan Local Moran’s I.
Directory adalah file dimana kita menyimpan file dalam komputer atau PC
setwd("E:/ADI BUANA/SEMESTER 7/PETA JATIM 2017 AKB")
data <- read.csv("data spasial.csv")
gambar <- readShapeSpatial("jatim.shp")
names(gambar)
[1] "POLY_ID" "KODE_KAB" "NAMA_KAB" "KODE_PROP" "NAMA_PROP"
[6] "IPM" "AKB" "PKM" "ASI" "LS"
[11] "AIR" "JAMBAN" "MISKIN" "PKPT"
mydata <- readr::read_csv("E:/ADI BUANA/SEMESTER 7/PETA JATIM 2017 AKB/data spasial.csv")
## Parsed with column specification:
## cols(
## POLY_ID = col_double(),
## KODE_KAB = col_double(),
## NAMA_KAB = col_character(),
## KODE_PROP = col_double(),
## NAMA_PROP = col_character(),
## IPM = col_double(),
## AKB = col_double(),
## PKM = col_double(),
## ASI = col_double(),
## LS = col_double(),
## AIR = col_double(),
## JAMBAN = col_double(),
## MISKIN = col_double(),
## PKPT = col_double()
## )
map <- st_read("E:/ADI BUANA/SEMESTER 7/PETA JATIM 2017 AKB/jatim.shp", stringsAsFactors = FALSE)
## Reading layer `jatim' from data source `E:\ADI BUANA\SEMESTER 7\PETA JATIM 2017 AKB\jatim.shp' using driver `ESRI Shapefile'
## Simple feature collection with 38 features and 14 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: 110.8984 ymin: -8.780764 xmax: 116.2634 ymax: -5.527337
## epsg (SRID): NA
## proj4string: NA
datatable(data)
summa <- summary(gambar$IPM)
print(summa)
Min. 1st Qu. Median Mean 3rd Qu. Max.
59.90 65.89 69.80 70.24 73.87 81.07
standar <- sd(gambar$IPM)
standar
[1] 5.39587
Berdasarkan output diatas dapat dilihat bahwa nilai minimum untuk Indeks Pembanagunan Manusia adalah sebesar 59.9, kemudian nilai rata-rata adalah sebesar 70.2428947 dengan nilai standar deviasi sebesar 5.3958697 dan nilai maksimum adalah sebesar 81.07
str(map)
Classes 'sf' and 'data.frame': 38 obs. of 15 variables:
$ POLY_ID : num 1 2 3 4 5 6 7 8 9 10 ...
$ KODE_KAB : num 3501 3502 3503 3504 3508 ...
$ NAMA_KAB : chr "PACITAN" "PONOROGO" "TRENGGALEK" "TULUNGAGUNG" ...
$ KODE_PROP: num 35 35 35 35 35 35 35 35 35 35 ...
$ NAMA_PROP: chr "JAWA TIMUR" "JAWA TIMUR" "JAWA TIMUR" "JAWA TIMUR" ...
$ IPM : num 66.5 69.3 68.1 71.2 64.2 ...
$ AKB : num 24.5 31.4 24.1 25.4 42.9 ...
$ PKM : num 85.6 90.3 86.2 95.9 85 ...
$ ASI : num 3.04 3.16 3.4 3.59 2.75 2.3 1.43 2.51 3 3.19 ...
$ LS : num 6.73 6.57 7.14 7.48 6 5.32 6.54 7.61 7.27 7.32 ...
$ AIR : num 83.4 93.4 77.8 91.4 93.3 ...
$ JAMBAN : num 32.4 53.7 45.3 59 21.8 ...
$ MISKIN : num 19.79 10.68 15.28 9.97 17.59 ...
$ PKPT : num 5.06 6.83 5.56 14.49 11.69 ...
$ geometry :sfc_MULTIPOLYGON of length 38; first list element: List of 1
..$ :List of 1
.. ..$ : num [1:884, 1:2] 111 111 111 111 111 ...
..- attr(*, "class")= chr "XY" "MULTIPOLYGON" "sfg"
- attr(*, "sf_column")= chr "geometry"
- attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA NA NA NA ...
..- attr(*, "names")= chr "POLY_ID" "KODE_KAB" "NAMA_KAB" "KODE_PROP" ...
map_dan_data <- merge(map,mydata)
str(map_dan_data)
Classes 'sf' and 'data.frame': 38 obs. of 15 variables:
$ POLY_ID : num 1 10 11 12 13 14 15 16 17 18 ...
$ KODE_KAB : num 3501 3519 3520 3521 3522 ...
$ NAMA_KAB : chr "PACITAN" "MADIUN" "MAGETAN" "NGAWI" ...
$ KODE_PROP: num 35 35 35 35 35 35 35 35 35 35 ...
$ NAMA_PROP: chr "JAWA TIMUR" "JAWA TIMUR" "JAWA TIMUR" "JAWA TIMUR" ...
$ IPM : num 66.5 70.3 72.6 69.3 67.3 ...
$ AKB : num 24.5 34.9 28.8 32.5 40.8 ...
$ PKM : num 85.6 96.8 95.7 93.8 78 ...
$ ASI : num 3.04 3.19 2.59 3.1 3.05 3.34 2.25 1.06 1.56 3.23 ...
$ LS : num 6.73 7.32 7.61 6.21 6.24 6.15 7.09 4.65 6.02 9.89 ...
$ AIR : num 83.4 95.8 95.5 95.6 94.2 ...
$ JAMBAN : num 32.4 58.2 67.2 35.1 30.4 ...
$ MISKIN : num 19.8 15.4 12.8 23.9 23 ...
$ PKPT : num 5.06 7.99 9.86 7.29 10.94 ...
$ geometry :sfc_MULTIPOLYGON of length 38; first list element: List of 1
..$ :List of 1
.. ..$ : num [1:884, 1:2] 111 111 111 111 111 ...
..- attr(*, "class")= chr "XY" "MULTIPOLYGON" "sfg"
- attr(*, "sf_column")= chr "geometry"
- attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA NA NA NA ...
..- attr(*, "names")= chr "POLY_ID" "KODE_KAB" "NAMA_KAB" "KODE_PROP" ...
ggplot(map_dan_data) + geom_sf(aes(fill = IPM)) +
geom_sf_label(aes(label = NAMA_KAB), label.size = 0.20, position = "identity") +
xlab("Longitude") + ylab("Latitude") +
ggtitle("Persebaran IPM di Jawa Timur")
ggplot(map_dan_data) + geom_sf(aes(fill = IPM)) + scale_fill_gradient(high = "#56B1F7", low = "#132B43")
tm_shape(map_dan_data) +
tm_polygons("IPM", id = "NAMA_KAB", palette = "Greens")
tm_shape(map_dan_data) + tm_fill("IPM", id = "NAMA_KAB", style = "quantile", n = 4, palette = "Paired")
## Warning: Currect projection of shape map_dan_data unknown. Long-lat (WGS84)
## is assumed.
## Warning: unknown projection
tm_shape(map_dan_data) + tm_fill("IPM", id = "NAMA_KAB", style = "quantile", n = 4, palette = "Accent") + tm_borders(alpha = .4)
## Warning: Currect projection of shape map_dan_data unknown. Long-lat (WGS84)
## is assumed.
## Warning: unknown projection
tm_shape(map_dan_data) + tm_fill("IPM", id = "NAMA_KAB", style = "quantile", n = 4, palette = "Accent") + tm_borders(alpha = .6) + tm_compass()
## Warning: Currect projection of shape map_dan_data unknown. Long-lat (WGS84)
## is assumed.
## Warning: unknown projection
tm_shape(map_dan_data) + tm_fill("IPM", id = "NAMA_KAB", style = "quantile", n = 4, palette = "Accent") + tm_borders(alpha = .6) + tm_layout(title = "East Java, Indonesia", legend.text.size = 1.1, legend.title.size = 1.4, legend.position = c("right", "top"), frame = FALSE)
## Warning: Currect projection of shape map_dan_data unknown. Long-lat (WGS84)
## is assumed.
## Warning: unknown projection
tmap_mode("view")
## tmap mode set to interactive viewing
tmap_last()
tm_shape(map_dan_data) +
tm_dots(title = "IPM East Java", border.col = "black",
border.lwd = 0.1, border.alpha = 0.2,
col = "IPM", id = "NAMA_KAB", style = "quantile", palette = "Reds")
## Warning: Currect projection of shape map_dan_data unknown. Long-lat (WGS84)
## is assumed.
tm_shape(map_dan_data) + tm_bubbles(size = "IPM", id = "NAMA_KAB", title.size = "IPM East Java", border.col = "black", border.lwd = 0.1, border.alpha = 0.4, legend.size.show = TRUE)
## Warning: Currect projection of shape map_dan_data unknown. Long-lat (WGS84)
## is assumed.
## Legend for symbol sizes not available in view mode.
tm_shape(map_dan_data) + tm_fill("IPM", id = "NAMA_KAB", palette = "Reds", style = "quantile", n = 4, title = "IPM East Java") + tm_borders(alpha=.5)
## Warning: Currect projection of shape map_dan_data unknown. Long-lat (WGS84)
## is assumed.
plot(gambar, main="Peta Jawa Timur", axes=T)
Matriks pembobot spasial (W) diperoleh berdasarkan informasi ketersinggungan antar wilayah dan jarak dari ketetanggaan (neighborhood) atau dalam kata lain yaitu jarak antara satu wilayah dengan wilayah lainnya.
Menurut LeSage (1999), persinggungan (contiguity) dapat dijabarkan sebagai berikut (Matrik pembobot spasial area):
queen.c <- poly2nb(gambar, row.names = gambar$NAMA_KAB, queen = T)
summary(queen.c)
Neighbour list object:
Number of regions: 38
Number of nonzero links: 140
Percentage nonzero weights: 9.695291
Average number of links: 3.684211
Link number distribution:
1 2 3 4 5 6 7 8 9
8 6 5 7 2 6 2 1 1
8 least connected regions:
BANGKALAN KEDIRI (KOTA) BLITAR (KOTA) MALANG (KOTA) PROBOLINGGO (KOTA) PASURUAN (KOTA) MOJOKERTO (KOTA) SUMENEP with 1 link
1 most connected region:
MALANG with 9 links
Kabupaten / Kota yang hanya mempunyai 1 tetangga ada 8 daerah yaitu Kab Bangkalan, Sumenep, Kota Kediri, Kota Blitar, Kota Malang, Kota Probolinggo, Kota Pasuruan dan Kota Mojokerto. Daerah yang memiliki 2 sampai 4 tetangga masing-masing ada 6 Kabupaten/Kota dan yang terbanyak contiguity-nya adalah Kabupaten Malang dengan 9 tetangga
str(queen.c)
List of 38
$ : int [1:2] 2 3
$ : int [1:6] 1 3 4 9 10 11
$ : int [1:3] 1 2 4
$ : int [1:5] 2 3 9 27 28
$ : int [1:4] 7 32 33 34
$ : int [1:4] 30 32 34 37
$ : int [1:7] 5 22 26 29 33 34 36
$ : int [1:6] 9 13 15 28 29 33
$ : int [1:6] 2 4 8 10 13 28
$ : int [1:6] 2 9 11 12 13 24
$ : int [1:4] 2 10 12 24
$ : int [1:3] 10 11 13
$ : int [1:6] 8 9 10 12 14 15
$ : int [1:2] 13 15
$ : int [1:5] 8 13 14 29 31
$ : int 35
$ : int [1:2] 35 38
$ : int 28
$ : int 27
$ : int 33
$ : int 34
$ : int 7
$ : int 29
$ : int [1:2] 10 11
$ : int [1:2] 31 36
$ : int [1:3] 7 29 33
$ : int [1:4] 4 19 28 33
$ : int [1:6] 4 8 9 18 27 33
$ : int [1:8] 7 8 15 23 26 31 33 36
$ : int [1:3] 6 32 37
$ : int [1:4] 15 25 29 36
$ : int [1:4] 5 6 30 34
$ : int [1:9] 5 7 8 20 26 27 28 29 34
$ : int [1:7] 5 6 7 21 32 33 37
$ : int [1:2] 16 17
$ : int [1:4] 7 25 29 31
$ : int [1:3] 6 30 34
$ : int 17
- attr(*, "class")= chr "nb"
- attr(*, "region.id")= Factor w/ 38 levels "BANGKALAN","BANYUWANGI",..: 24 28 36 38 14 7 26 10 22 15 ...
- attr(*, "call")= language poly2nb(pl = gambar, row.names = gambar$NAMA_KAB, queen = T)
- attr(*, "type")= chr "queen"
- attr(*, "sym")= logi TRUE
plot(gambar, col="brown", border = "black",lwd="1")
plot(queen.c, coordinates(gambar), add = TRUE, lwd = "2", col = "blue")
queen.wl <- nb2listw(queen.c, style = "W")
summary(queen.wl)
Characteristics of weights list object:
Neighbour list object:
Number of regions: 38
Number of nonzero links: 140
Percentage nonzero weights: 9.695291
Average number of links: 3.684211
Link number distribution:
1 2 3 4 5 6 7 8 9
8 6 5 7 2 6 2 1 1
8 least connected regions:
BANGKALAN KEDIRI (KOTA) BLITAR (KOTA) MALANG (KOTA) PROBOLINGGO (KOTA) PASURUAN (KOTA) MOJOKERTO (KOTA) SUMENEP with 1 link
1 most connected region:
MALANG with 9 links
Weights style: W
Weights constants summary:
n nn S0 S1 S2
W 38 1444 38 26.78738 169.3149
queen.mw = nb2mat(queen.c, style = "W")
print(queen.mw, digits = 3)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
PACITAN 0.000 0.500 0.500 0.000 0.000 0.000 0.000 0.000 0.000
PONOROGO 0.167 0.000 0.167 0.167 0.000 0.000 0.000 0.000 0.167
TRENGGALEK 0.333 0.333 0.000 0.333 0.000 0.000 0.000 0.000 0.000
TULUNGAGUNG 0.000 0.200 0.200 0.000 0.000 0.000 0.000 0.000 0.200
LUMAJANG 0.000 0.000 0.000 0.000 0.000 0.000 0.250 0.000 0.000
BONDOWOSO 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
PASURUAN 0.000 0.000 0.000 0.000 0.143 0.000 0.000 0.000 0.000
JOMBANG 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.167
NGANJUK 0.000 0.167 0.000 0.167 0.000 0.000 0.000 0.167 0.000
MADIUN 0.000 0.167 0.000 0.000 0.000 0.000 0.000 0.000 0.167
MAGETAN 0.000 0.250 0.000 0.000 0.000 0.000 0.000 0.000 0.000
NGAWI 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
BOJONEGORO 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.167 0.167
TUBAN 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
LAMONGAN 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.200 0.000
BANGKALAN 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
PAMEKASAN 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
KEDIRI (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
BLITAR (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
MALANG (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
PROBOLINGGO (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
PASURUAN (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000
MOJOKERTO (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
MADIUN (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
SURABAYA (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
BATU (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.333 0.000 0.000
BLITAR 0.000 0.000 0.000 0.250 0.000 0.000 0.000 0.000 0.000
KEDIRI 0.000 0.000 0.000 0.167 0.000 0.000 0.000 0.167 0.167
MOJOKERTO 0.000 0.000 0.000 0.000 0.000 0.000 0.125 0.125 0.000
BANYUWANGI 0.000 0.000 0.000 0.000 0.000 0.333 0.000 0.000 0.000
GRESIK 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
JEMBER 0.000 0.000 0.000 0.000 0.250 0.250 0.000 0.000 0.000
MALANG 0.000 0.000 0.000 0.000 0.111 0.000 0.111 0.111 0.000
PROBOLINGGO 0.000 0.000 0.000 0.000 0.143 0.143 0.143 0.000 0.000
SAMPANG 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
SIDOARJO 0.000 0.000 0.000 0.000 0.000 0.000 0.250 0.000 0.000
SITUBONDO 0.000 0.000 0.000 0.000 0.000 0.333 0.000 0.000 0.000
SUMENEP 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
[,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18]
PACITAN 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
PONOROGO 0.167 0.167 0.000 0.000 0.000 0.000 0.0 0.0 0.000
TRENGGALEK 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
TULUNGAGUNG 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
LUMAJANG 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
BONDOWOSO 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
PASURUAN 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
JOMBANG 0.000 0.000 0.000 0.167 0.000 0.167 0.0 0.0 0.000
NGANJUK 0.167 0.000 0.000 0.167 0.000 0.000 0.0 0.0 0.000
MADIUN 0.000 0.167 0.167 0.167 0.000 0.000 0.0 0.0 0.000
MAGETAN 0.250 0.000 0.250 0.000 0.000 0.000 0.0 0.0 0.000
NGAWI 0.333 0.333 0.000 0.333 0.000 0.000 0.0 0.0 0.000
BOJONEGORO 0.167 0.000 0.167 0.000 0.167 0.167 0.0 0.0 0.000
TUBAN 0.000 0.000 0.000 0.500 0.000 0.500 0.0 0.0 0.000
LAMONGAN 0.000 0.000 0.000 0.200 0.200 0.000 0.0 0.0 0.000
BANGKALAN 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
PAMEKASAN 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
KEDIRI (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
BLITAR (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
MALANG (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
PROBOLINGGO (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
PASURUAN (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
MOJOKERTO (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
MADIUN (KOTA) 0.500 0.500 0.000 0.000 0.000 0.000 0.0 0.0 0.000
SURABAYA (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
BATU (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
BLITAR 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
KEDIRI 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.167
MOJOKERTO 0.000 0.000 0.000 0.000 0.000 0.125 0.0 0.0 0.000
BANYUWANGI 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
GRESIK 0.000 0.000 0.000 0.000 0.000 0.250 0.0 0.0 0.000
JEMBER 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
MALANG 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
PROBOLINGGO 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
SAMPANG 0.000 0.000 0.000 0.000 0.000 0.000 0.5 0.5 0.000
SIDOARJO 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
SITUBONDO 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.0 0.000
SUMENEP 0.000 0.000 0.000 0.000 0.000 0.000 0.0 1.0 0.000
[,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [,27]
PACITAN 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
PONOROGO 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
TRENGGALEK 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
TULUNGAGUNG 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.200
LUMAJANG 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
BONDOWOSO 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
PASURUAN 0.00 0.000 0.000 0.143 0.000 0.000 0.00 0.143 0.000
JOMBANG 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
NGANJUK 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
MADIUN 0.00 0.000 0.000 0.000 0.000 0.167 0.00 0.000 0.000
MAGETAN 0.00 0.000 0.000 0.000 0.000 0.250 0.00 0.000 0.000
NGAWI 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
BOJONEGORO 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
TUBAN 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
LAMONGAN 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
BANGKALAN 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
PAMEKASAN 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
KEDIRI (KOTA) 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
BLITAR (KOTA) 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 1.000
MALANG (KOTA) 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
PROBOLINGGO (KOTA) 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
PASURUAN (KOTA) 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
MOJOKERTO (KOTA) 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
MADIUN (KOTA) 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
SURABAYA (KOTA) 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
BATU (KOTA) 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
BLITAR 0.25 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
KEDIRI 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.167
MOJOKERTO 0.00 0.000 0.000 0.000 0.125 0.000 0.00 0.125 0.000
BANYUWANGI 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
GRESIK 0.00 0.000 0.000 0.000 0.000 0.000 0.25 0.000 0.000
JEMBER 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
MALANG 0.00 0.111 0.000 0.000 0.000 0.000 0.00 0.111 0.111
PROBOLINGGO 0.00 0.000 0.143 0.000 0.000 0.000 0.00 0.000 0.000
SAMPANG 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
SIDOARJO 0.00 0.000 0.000 0.000 0.000 0.000 0.25 0.000 0.000
SITUBONDO 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
SUMENEP 0.00 0.000 0.000 0.000 0.000 0.000 0.00 0.000 0.000
[,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36]
PACITAN 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
PONOROGO 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
TRENGGALEK 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
TULUNGAGUNG 0.200 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
LUMAJANG 0.000 0.000 0.000 0.000 0.250 0.250 0.250 0.0 0.000
BONDOWOSO 0.000 0.000 0.250 0.000 0.250 0.000 0.250 0.0 0.000
PASURUAN 0.000 0.143 0.000 0.000 0.000 0.143 0.143 0.0 0.143
JOMBANG 0.167 0.167 0.000 0.000 0.000 0.167 0.000 0.0 0.000
NGANJUK 0.167 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
MADIUN 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
MAGETAN 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
NGAWI 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
BOJONEGORO 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
TUBAN 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
LAMONGAN 0.000 0.200 0.000 0.200 0.000 0.000 0.000 0.0 0.000
BANGKALAN 0.000 0.000 0.000 0.000 0.000 0.000 0.000 1.0 0.000
PAMEKASAN 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.5 0.000
KEDIRI (KOTA) 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
BLITAR (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
MALANG (KOTA) 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.0 0.000
PROBOLINGGO (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 1.000 0.0 0.000
PASURUAN (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
MOJOKERTO (KOTA) 0.000 1.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
MADIUN (KOTA) 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
SURABAYA (KOTA) 0.000 0.000 0.000 0.500 0.000 0.000 0.000 0.0 0.500
BATU (KOTA) 0.000 0.333 0.000 0.000 0.000 0.333 0.000 0.0 0.000
BLITAR 0.250 0.000 0.000 0.000 0.000 0.250 0.000 0.0 0.000
KEDIRI 0.000 0.000 0.000 0.000 0.000 0.167 0.000 0.0 0.000
MOJOKERTO 0.000 0.000 0.000 0.125 0.000 0.125 0.000 0.0 0.125
BANYUWANGI 0.000 0.000 0.000 0.000 0.333 0.000 0.000 0.0 0.000
GRESIK 0.000 0.250 0.000 0.000 0.000 0.000 0.000 0.0 0.250
JEMBER 0.000 0.000 0.250 0.000 0.000 0.000 0.250 0.0 0.000
MALANG 0.111 0.111 0.000 0.000 0.000 0.000 0.111 0.0 0.000
PROBOLINGGO 0.000 0.000 0.000 0.000 0.143 0.143 0.000 0.0 0.000
SAMPANG 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
SIDOARJO 0.000 0.250 0.000 0.250 0.000 0.000 0.000 0.0 0.000
SITUBONDO 0.000 0.000 0.333 0.000 0.000 0.000 0.333 0.0 0.000
SUMENEP 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0 0.000
[,37] [,38]
PACITAN 0.000 0.0
PONOROGO 0.000 0.0
TRENGGALEK 0.000 0.0
TULUNGAGUNG 0.000 0.0
LUMAJANG 0.000 0.0
BONDOWOSO 0.250 0.0
PASURUAN 0.000 0.0
JOMBANG 0.000 0.0
NGANJUK 0.000 0.0
MADIUN 0.000 0.0
MAGETAN 0.000 0.0
NGAWI 0.000 0.0
BOJONEGORO 0.000 0.0
TUBAN 0.000 0.0
LAMONGAN 0.000 0.0
BANGKALAN 0.000 0.0
PAMEKASAN 0.000 0.5
KEDIRI (KOTA) 0.000 0.0
BLITAR (KOTA) 0.000 0.0
MALANG (KOTA) 0.000 0.0
PROBOLINGGO (KOTA) 0.000 0.0
PASURUAN (KOTA) 0.000 0.0
MOJOKERTO (KOTA) 0.000 0.0
MADIUN (KOTA) 0.000 0.0
SURABAYA (KOTA) 0.000 0.0
BATU (KOTA) 0.000 0.0
BLITAR 0.000 0.0
KEDIRI 0.000 0.0
MOJOKERTO 0.000 0.0
BANYUWANGI 0.333 0.0
GRESIK 0.000 0.0
JEMBER 0.000 0.0
MALANG 0.000 0.0
PROBOLINGGO 0.143 0.0
SAMPANG 0.000 0.0
SIDOARJO 0.000 0.0
SITUBONDO 0.000 0.0
SUMENEP 0.000 0.0
attr(,"call")
nb2mat(neighbours = queen.c, style = "W")
plot(gambar, border = "black")
plot.queen <- plot(queen.c, coordinates(gambar), add = TRUE, col = "red")
Moran’s scatter plot terdiri dari 4 kuadran (Anselin, 2005). Kuadran high-high (upper right) / kuadran I dan low-low (lower left) / kuadran III menunjukkan autokorelasi spasial (spatial autocorrelation) positif, high-low / kuadran IV dan low-high / kuadran II menunjukkan autokorelasi spasial (spatial autocorrelation) negatif
r.queen.s = mat2listw(queen.mw, style = "W")
y = gambar$IPM
moran.plot(y, r.queen.s, main = "Scatter Plot Global Moran's I")
Pola pengelompokan dan penyebaran antar lokasi dapat disajikan dengan Moran’s Scatterplot, yang menunjukkan hubungan antara nilai amatan pada suatu lokasi (distandarisasi) dengan rata-rata nilai amatan dari lokasi-lokasi yang bertetanggaan dengan lokasi yang bersangkutan (Lee dan Wong, 2001). Scatterplot tersebut terdiri atas empat kuadran (Perobelli dan Haddad, 2003), yaitu:
Nilai indeks -1 menunjukkan autokorelasi spasial (spatial autocorrelation) negatif
Hipotesis dan Statistik uji yang digunakan dalam pengujian dependensi spasial atau autokorelasi spasial (spatial autocorrelation) adalah sebagai berikut (Lee dan Wong, 2001) :
H0 : (tidak terjadi autokorelasi spasial / spatial autocorrelation antar lokasi)
H1 : (terjadi autokorelasi spasial / spatial autocorrelation antar lokasi)
\[Z_{hit} = \frac {I-I_{0}}{\sqrt {{Var}(I)}}\]
dimana nilai Moran’s I adalah
\[I = \frac {\sum_{i=1}^n \sum_{j=1}^n{W_{ij}(x_{i}-\bar{x})(x_{j}-\bar{x})}}{ \sum_{i=i}^n({{x}_{i}-{\bar{x}})}^2}\]
\[ E(I) =I_{0}= - \frac {1} {n-1} \]
\[ Var(I) = - \frac {n^2S_{1}-nS_{2}+3S_{0}^2} {(n^2-1)S_{0}^2}\]
\[S_{1} = \frac {1}{2} \sum_{j=!1}^n(W_{ji}+W_{ji})^2 \]
\[ S_{2} = \sum_{j=1}^n(w_{i0} + w_{0i}) \]
\[ S_{0} = \sum_{i=1}^n \sum_{j=1}^n w_{ij} \]
\[ w_{i0} = \sum_{j=1}^n w_{ij} \]
\[ w_{0i} = \sum_{i=1}^n w_{ji} \]
Nilai dari indeks Moran’s I berkisar antara -1 dan 1. Identifikasi pola menggunakan kriteria nilai indeks I, jika I>I0, maka mempunyai pola mengelompok (cluster), jika I=I0 , maka berpola menyebar tidak merata (tidak ada autokorelasi), dan I
moran
## Influence measures of
## lm(formula = wx ~ x) :
##
## dfb.1_ dfb.x dffit cov.r cook.d hat inf
## PACITAN 0.071740 -0.064926 0.11310 1.082 0.0065201 0.0393
## PONOROGO 0.022833 -0.016233 0.08942 1.070 0.0040791 0.0272
## TRENGGALEK 0.031503 -0.026587 0.07121 1.081 0.0025958 0.0306
## TULUNGAGUNG -0.001243 0.002095 0.01138 1.087 0.0000666 0.0272
## LUMAJANG 0.001721 -0.001617 0.00216 1.125 0.0000024 0.0599
## BONDOWOSO -0.102076 0.095362 -0.13281 1.099 0.0089924 0.0543
## PASURUAN 0.174583 -0.157224 0.28326 0.983 0.0390022 0.0380
## JOMBANG -0.002343 0.006411 0.05396 1.080 0.0014929 0.0267
## NGANJUK -0.000383 0.003941 0.04710 1.082 0.0011383 0.0265
## MADIUN 0.011336 0.000819 0.16078 1.030 0.0129415 0.0263
## MAGETAN -0.050106 0.060632 0.14978 1.050 0.0113143 0.0315
## NGAWI 0.024958 -0.017691 0.09842 1.066 0.0049330 0.0272
## BOJONEGORO 0.089524 -0.079017 0.16250 1.051 0.0132994 0.0345
## TUBAN 0.085056 -0.076419 0.13988 1.068 0.0099204 0.0375
## LAMONGAN -0.005837 0.010950 0.06812 1.077 0.0023754 0.0270
## BANGKALAN -0.575512 0.549255 -0.66124 0.898 0.1981751 0.0849
## PAMEKASAN -0.304470 0.283786 -0.40177 0.952 0.0766385 0.0525
## KEDIRI (KOTA) 0.129028 -0.137453 -0.17374 1.113 0.0153491 0.0703
## BLITAR (KOTA) 0.217988 -0.232285 -0.29409 1.066 0.0430648 0.0700
## MALANG (KOTA) 0.688630 -0.718468 -0.80704 0.952 0.2969271 0.1269 *
## PROBOLINGGO (KOTA) 0.145561 -0.174808 -0.41860 0.823 0.0782201 0.0319 *
## PASURUAN (KOTA) 0.187367 -0.208163 -0.33876 0.957 0.0549380 0.0423
## MOJOKERTO (KOTA) -0.029306 0.031327 0.04043 1.131 0.0008400 0.0659
## MADIUN (KOTA) 0.251286 -0.262731 -0.29841 1.154 0.0449328 0.1171
## SURABAYA (KOTA) -0.383534 0.399527 0.44522 1.139 0.0983778 0.1351
## BATU (KOTA) 0.065279 -0.072778 -0.12084 1.082 0.0074374 0.0413
## BLITAR 0.051873 -0.036074 0.21347 0.992 0.0223886 0.0271
## KEDIRI 0.004671 0.006028 0.14146 1.042 0.0100788 0.0264
## MOJOKERTO -0.056541 0.070058 0.18961 1.023 0.0179046 0.0305
## BANYUWANGI -0.085095 0.079557 -0.11022 1.106 0.0062107 0.0549
## GRESIK -0.243271 0.267449 0.40924 0.917 0.0783460 0.0459
## JEMBER -0.133034 0.123947 -0.17598 1.081 0.0156746 0.0522
## MALANG 0.049260 -0.039314 0.13877 1.050 0.0097215 0.0286
## PROBOLINGGO 0.049646 -0.046632 0.06252 1.121 0.0020064 0.0593
## SAMPANG -0.068205 0.065832 -0.07404 1.207 0.0028164 0.1256 *
## SIDOARJO -0.087427 0.092072 0.10880 1.158 0.0060677 0.0927
## SITUBONDO -0.130172 0.119937 -0.18431 1.065 0.0171237 0.0456
## SUMENEP -0.092089 0.086498 -0.11596 1.111 0.0068739 0.0593
globalmorans <- moran.test(y, listw = queen.wl, alternative = "two.sided")
print(globalmorans)
Moran I test under randomisation
data: y
weights: queen.wl
Moran I statistic standard deviate = 3.7646, p-value = 0.0001668
alternative hypothesis: two.sided
sample estimates:
Moran I statistic Expectation Variance
0.46495720 -0.02702703 0.01707953
hasil = globalmorans[2]
Moran’s I digunakan untuk mengukur dependensi spasial suatu variabel anta amatan. Berdasarkan hasil penhitungan pada output dapat dilihat bahwa terdapat autokorelasi spasial pada IPM Jawa Timur tahun 2017 dengan tingkat signifikansi 0.05. Nilai p-value yang didapatka pada output diatas sebesar 0.0001668. nilai p-value tersebut yang kurang dari alfa 0.05 sehingga H0 ditolak. Nilai moran’s I sebesar 3.7645516 yang lebih besar dari nilai 0 menunjukkan ada autokorelasi positif atau pola yang mengelompok dan memiliki kesamaan karakteristik pada lokasi yang berdekatan. Autokorelasi positif ini juga terlihat dari grafik pada gambar diatas yang menunjukkan bahwa garis regresi mengarah ke kanan.
Berdasarkan pengujian Moran’s I menunjukkan bahwa terdapat autokerelasi atau hubungan spasial Indeks Pembangunan Manusia di Jawa Timur tahun 2017. Selanjutnya pada Moran’s scatterplot juga digambarkan bagaimana pola hubungan antar kabupaten/kota yang ada. Untuk mengetahui signifikansi autokorelasi spasial secara lokal adalah melalui Local Moran’s I. Dari pengujian Local Moran’s I akan didapatkan signifikansi hubungan secara lokal pada masing-masing kabupaten/kota.
localmorans = localmoran(y,
listw = queen.wl,
alternative = "two.sided")
print(localmorans, digits = 2)
Ii E.Ii Var.Ii Z.Ii Pr(z != 0)
PACITAN 0.2058 -0.027 0.469 0.3401 0.73381
PONOROGO 0.0118 -0.027 0.139 0.1042 0.91701
TRENGGALEK 0.0937 -0.027 0.304 0.2190 0.82666
TULUNGAGUNG -0.0237 -0.027 0.172 0.0081 0.99354
LUMAJANG 0.8681 -0.027 0.221 1.9020 0.05717
BONDOWOSO 1.0347 -0.027 0.221 2.2561 0.02407
PASURUAN -0.0929 -0.027 0.116 -0.1938 0.84629
JOMBANG -0.0033 -0.027 0.139 0.0637 0.94924
NGANJUK -0.0054 -0.027 0.139 0.0580 0.95377
MADIUN 0.0012 -0.027 0.139 0.0758 0.93958
MAGETAN 0.1654 -0.027 0.221 0.4089 0.68259
NGAWI 0.0066 -0.027 0.304 0.0610 0.95133
BOJONEGORO 0.0430 -0.027 0.139 0.1877 0.85110
TUBAN 0.1284 -0.027 0.469 0.2270 0.82044
LAMONGAN 0.0056 -0.027 0.172 0.0787 0.93730
BANGKALAN 2.8979 -0.027 0.963 2.9802 0.00288
PAMEKASAN 1.5279 -0.027 0.469 2.2712 0.02314
KEDIRI (KOTA) 0.0552 -0.027 0.963 0.0838 0.93325
BLITAR (KOTA) -0.2208 -0.027 0.963 -0.1974 0.84348
MALANG (KOTA) -0.5774 -0.027 0.963 -0.5608 0.57494
PROBOLINGGO (KOTA) -0.5147 -0.027 0.963 -0.4969 0.61925
PASURUAN (KOTA) -0.5197 -0.027 0.963 -0.5020 0.61565
MOJOKERTO (KOTA) 0.4874 -0.027 0.963 0.5242 0.60015
MADIUN (KOTA) 0.4158 -0.027 0.469 0.6467 0.51780
SURABAYA (KOTA) 2.4928 -0.027 0.469 3.6805 0.00023
BATU (KOTA) -0.1421 -0.027 0.304 -0.2088 0.83464
BLITAR -0.0524 -0.027 0.221 -0.0539 0.95701
KEDIRI 0.0087 -0.027 0.139 0.0957 0.92377
MOJOKERTO 0.1865 -0.027 0.098 0.6825 0.49493
BANYUWANGI 1.0015 -0.027 0.304 1.8657 0.06209
GRESIK 0.9028 -0.027 0.221 1.9756 0.04820
JEMBER 1.0725 -0.027 0.221 2.3363 0.01947
MALANG -0.0059 -0.027 0.084 0.0727 0.94205
PROBOLINGGO 0.7221 -0.027 0.116 2.2039 0.02753
SAMPANG 2.4181 -0.027 0.469 3.5714 0.00036
SIDOARJO 1.0433 -0.027 0.221 2.2741 0.02296
SITUBONDO 0.9125 -0.027 0.304 1.7043 0.08832
SUMENEP 1.1175 -0.027 0.963 1.1662 0.24355
attr(,"call")
localmoran(x = y, listw = queen.wl, alternative = "two.sided")
attr(,"class")
[1] "localmoran" "matrix"
Berdasarkan tabel output diatasa dapat dilihat bahwa Kabupaten Bondowoso, Kabupaten Bangkalan, Kabupaten Pamekasan, Kabupaten Gresik, kabupaten Jember, Kabupaten Probolinggo, Kabupaten Sampang dan kabupaten Sidoarjo memiliki dependensi dalam indikator IPM dengan tingkat kepercayaan 95 persen. Dengan demikian dapat disimpulkan bahwa wilayah tersebut memeiliki keterkaitan spasial dengan wilayah terdekatnya dalam hal IPM antar wilayah di Jawa Timur.
nilai_moran_lokal <- localmoran(x = gambar$IPM,
listw = nb2listw(queen.c, style = "W"), alternative = "two.sided")
print(nilai_moran_lokal, digits = 2)
Ii E.Ii Var.Ii Z.Ii Pr(z != 0)
PACITAN 0.2058 -0.027 0.469 0.3401 0.73381
PONOROGO 0.0118 -0.027 0.139 0.1042 0.91701
TRENGGALEK 0.0937 -0.027 0.304 0.2190 0.82666
TULUNGAGUNG -0.0237 -0.027 0.172 0.0081 0.99354
LUMAJANG 0.8681 -0.027 0.221 1.9020 0.05717
BONDOWOSO 1.0347 -0.027 0.221 2.2561 0.02407
PASURUAN -0.0929 -0.027 0.116 -0.1938 0.84629
JOMBANG -0.0033 -0.027 0.139 0.0637 0.94924
NGANJUK -0.0054 -0.027 0.139 0.0580 0.95377
MADIUN 0.0012 -0.027 0.139 0.0758 0.93958
MAGETAN 0.1654 -0.027 0.221 0.4089 0.68259
NGAWI 0.0066 -0.027 0.304 0.0610 0.95133
BOJONEGORO 0.0430 -0.027 0.139 0.1877 0.85110
TUBAN 0.1284 -0.027 0.469 0.2270 0.82044
LAMONGAN 0.0056 -0.027 0.172 0.0787 0.93730
BANGKALAN 2.8979 -0.027 0.963 2.9802 0.00288
PAMEKASAN 1.5279 -0.027 0.469 2.2712 0.02314
KEDIRI (KOTA) 0.0552 -0.027 0.963 0.0838 0.93325
BLITAR (KOTA) -0.2208 -0.027 0.963 -0.1974 0.84348
MALANG (KOTA) -0.5774 -0.027 0.963 -0.5608 0.57494
PROBOLINGGO (KOTA) -0.5147 -0.027 0.963 -0.4969 0.61925
PASURUAN (KOTA) -0.5197 -0.027 0.963 -0.5020 0.61565
MOJOKERTO (KOTA) 0.4874 -0.027 0.963 0.5242 0.60015
MADIUN (KOTA) 0.4158 -0.027 0.469 0.6467 0.51780
SURABAYA (KOTA) 2.4928 -0.027 0.469 3.6805 0.00023
BATU (KOTA) -0.1421 -0.027 0.304 -0.2088 0.83464
BLITAR -0.0524 -0.027 0.221 -0.0539 0.95701
KEDIRI 0.0087 -0.027 0.139 0.0957 0.92377
MOJOKERTO 0.1865 -0.027 0.098 0.6825 0.49493
BANYUWANGI 1.0015 -0.027 0.304 1.8657 0.06209
GRESIK 0.9028 -0.027 0.221 1.9756 0.04820
JEMBER 1.0725 -0.027 0.221 2.3363 0.01947
MALANG -0.0059 -0.027 0.084 0.0727 0.94205
PROBOLINGGO 0.7221 -0.027 0.116 2.2039 0.02753
SAMPANG 2.4181 -0.027 0.469 3.5714 0.00036
SIDOARJO 1.0433 -0.027 0.221 2.2741 0.02296
SITUBONDO 0.9125 -0.027 0.304 1.7043 0.08832
SUMENEP 1.1175 -0.027 0.963 1.1662 0.24355
attr(,"call")
localmoran(x = gambar$IPM, listw = nb2listw(queen.c, style = "W"),
alternative = "two.sided")
attr(,"class")
[1] "localmoran" "matrix"
moran.mapa <- cbind(gambar, nilai_moran_lokal)
# maps the results
tm_shape(moran.mapa) + tm_fill(col = "Ii", style = "quantile",
title = "local moran statistic")
Variable "Ii" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
### Create LISA cluster map
kuadran <- vector(mode="numeric",length=nrow(nilai_moran_lokal))
# centers the variable of interest around its mean
ipm_klasifikasi <- gambar$IPM-mean(gambar$IPM)
# centers the local Moran's around the mean
I_moran_local <- nilai_moran_lokal[,1] - mean(nilai_moran_lokal[,1])
# significance threshold
signif <- 0.5
# builds a data quadrant
kuadran[ipm_klasifikasi > 0 & I_moran_local>0] <- 4
kuadran[ipm_klasifikasi < 0 & I_moran_local<0] <- 1
kuadran[ipm_klasifikasi < 0 & I_moran_local>0] <- 2
kuadran[ipm_klasifikasi > 0 & I_moran_local<0] <- 3
kuadran[nilai_moran_lokal[,5]>signif] <- 0
# plot in r
brks <- c(0,1,2,3,4)
colors <- c("white","blue",rgb(0,0,1,alpha=0.4),rgb(1,0,0,alpha=0.4),"red")
plot(gambar,border="lightgray",col=colors[findInterval(kuadran
,brks,all.inside=FALSE)])
box()
legend("topleft",legend=c("insignificant","low-low","low-high","high-low","high-high"),
fill=colors,bty="n")
# creates centroid and joins neighbours within 0 and x units
nbb <- dnearneigh(coordinates(gambar),0,38)
# creates listw
nb_lww <- nb2listw(nbb, style = 'B')
# plot the data and neighbours
plot(gambar, border = 'lightgrey')
plot(nbb, coordinates(gambar), add=TRUE, col = 'red')
# compute Getis-Ord Gi statistic
local_gg <- localG(gambar$IPM, nb_lww)
local_gg <- cbind(gambar, as.matrix(local_gg))
local_gg
## class : SpatialPolygonsDataFrame
## features : 38
## extent : 110.8984, 116.2634, -8.780764, -5.527337 (xmin, xmax, ymin, ymax)
## crs : NA
## variables : 15
## names : POLY_ID, KODE_KAB, NAMA_KAB, KODE_PROP, NAMA_PROP, IPM, AKB, PKM, ASI, LS, AIR, JAMBAN, MISKIN, PKPT, structure.c.Inf..Inf..NaN..NaN..Inf..Inf..Inf..Inf..Inf..Inf..
## min values : 1, 3501, BANGKALAN, 35, JAWA TIMUR, 59.9, 22.39, 46.67, 0.65, 3.8, 73.27, 14.47, 4.19, 5.06, NA
## max values : 38, 3579, TULUNGAGUNG, 35, JAWA TIMUR, 81.07, 69.14, 99.53, 3.84, 10.48, 99.84, 95.47, 46.11, 189.81, NA
names(local_gg)[6] <- "Nilai IPM"
## Warning in checkNames(value): attempt to set invalid names: this may lead
## to problems later on. See ?make.names
tm_shape(local_gg) + tm_fill("Nilai IPM", palette = "RdBu", style = "pretty") +
tm_borders(alpha=.4)
## Warning: Currect projection of shape local_gg unknown. Long-lat (WGS84) is
## assumed.